#include <os/syscall.h>

long (*syscall[NUM_SYSCALLS])();//64个元素的数组,每个元素是函数指针.

void handle_syscall(regs_context_t *regs, uint64_t interrupt, uint64_t cause)
{
    // syscall[fn](arg1, arg2, arg3)
    regs->sepc = regs->sepc + 4;
    //printk("here entry target syccall funtion");
    regs->regs[10] = /* 此处我觉得应该有*  */syscall[regs->regs[17]](regs->regs[10],//调用并执行a7对应的函数,a0,a1,a2为三个参数，并且返回值为a0
                                              regs->regs[11],
                                              regs->regs[12]);
}
/*typedef struct regs_context
{
   搬运一下这个结构体
    reg_t regs[32];			$10-$17是a0到a7寄存器

   
    reg_t sstatus;
    reg_t sepc;
    reg_t sbadaddr;
    reg_t scause;
} regs_context_t;	*/